Optimal. Leaf size=131 \[ -\frac {3 (A-B) \tanh ^{-1}(\sin (c+d x))}{2 a d}+\frac {(4 A-3 B) \tan (c+d x)}{a d}-\frac {3 (A-B) \sec (c+d x) \tan (c+d x)}{2 a d}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}+\frac {(4 A-3 B) \tan ^3(c+d x)}{3 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3057, 2827,
3852, 3853, 3855} \begin {gather*} \frac {(4 A-3 B) \tan ^3(c+d x)}{3 a d}+\frac {(4 A-3 B) \tan (c+d x)}{a d}-\frac {3 (A-B) \tanh ^{-1}(\sin (c+d x))}{2 a d}-\frac {3 (A-B) \tan (c+d x) \sec (c+d x)}{2 a d}-\frac {(A-B) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2827
Rule 3057
Rule 3852
Rule 3853
Rule 3855
Rubi steps
\begin {align*} \int \frac {(A+B \cos (c+d x)) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx &=-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}+\frac {\int (a (4 A-3 B)-3 a (A-B) \cos (c+d x)) \sec ^4(c+d x) \, dx}{a^2}\\ &=-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}+\frac {(4 A-3 B) \int \sec ^4(c+d x) \, dx}{a}-\frac {(3 (A-B)) \int \sec ^3(c+d x) \, dx}{a}\\ &=-\frac {3 (A-B) \sec (c+d x) \tan (c+d x)}{2 a d}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}-\frac {(3 (A-B)) \int \sec (c+d x) \, dx}{2 a}-\frac {(4 A-3 B) \text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (c+d x)\right )}{a d}\\ &=-\frac {3 (A-B) \tanh ^{-1}(\sin (c+d x))}{2 a d}+\frac {(4 A-3 B) \tan (c+d x)}{a d}-\frac {3 (A-B) \sec (c+d x) \tan (c+d x)}{2 a d}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}+\frac {(4 A-3 B) \tan ^3(c+d x)}{3 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(490\) vs. \(2(131)=262\).
time = 4.48, size = 490, normalized size = 3.74 \begin {gather*} \frac {\cos \left (\frac {1}{2} (c+d x)\right ) \left (144 (A-B) \cos \left (\frac {1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\sec \left (\frac {c}{2}\right ) \sec (c) \sec ^3(c+d x) \left (6 (A+B) \sin \left (\frac {d x}{2}\right )+3 (13 A-9 B) \sin \left (\frac {3 d x}{2}\right )-24 A \sin \left (c-\frac {d x}{2}\right )+12 B \sin \left (c-\frac {d x}{2}\right )-6 A \sin \left (c+\frac {d x}{2}\right )+6 B \sin \left (c+\frac {d x}{2}\right )-24 A \sin \left (2 c+\frac {d x}{2}\right )+24 B \sin \left (2 c+\frac {d x}{2}\right )+21 A \sin \left (c+\frac {3 d x}{2}\right )-9 B \sin \left (c+\frac {3 d x}{2}\right )+9 A \sin \left (2 c+\frac {3 d x}{2}\right )-9 B \sin \left (2 c+\frac {3 d x}{2}\right )-9 A \sin \left (3 c+\frac {3 d x}{2}\right )+9 B \sin \left (3 c+\frac {3 d x}{2}\right )+7 A \sin \left (c+\frac {5 d x}{2}\right )-3 B \sin \left (c+\frac {5 d x}{2}\right )+A \sin \left (2 c+\frac {5 d x}{2}\right )+3 B \sin \left (2 c+\frac {5 d x}{2}\right )-3 A \sin \left (3 c+\frac {5 d x}{2}\right )+3 B \sin \left (3 c+\frac {5 d x}{2}\right )-9 A \sin \left (4 c+\frac {5 d x}{2}\right )+9 B \sin \left (4 c+\frac {5 d x}{2}\right )+16 A \sin \left (2 c+\frac {7 d x}{2}\right )-12 B \sin \left (2 c+\frac {7 d x}{2}\right )+10 A \sin \left (3 c+\frac {7 d x}{2}\right )-6 B \sin \left (3 c+\frac {7 d x}{2}\right )+6 A \sin \left (4 c+\frac {7 d x}{2}\right )-6 B \sin \left (4 c+\frac {7 d x}{2}\right )\right )\right )}{48 a d (1+\cos (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.26, size = 190, normalized size = 1.45
method | result | size |
derivativedivides | \(\frac {-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {-2 A +B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (-\frac {3 A}{2}+\frac {3 B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {2 A -B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (\frac {3 A}{2}-\frac {3 B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{d a}\) | \(190\) |
default | \(\frac {-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {-2 A +B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (-\frac {3 A}{2}+\frac {3 B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {2 A -B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (\frac {3 A}{2}-\frac {3 B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{d a}\) | \(190\) |
norman | \(\frac {\frac {\left (A -B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {\left (A -3 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}-\frac {2 \left (2 A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}-\frac {\left (7 A -5 B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {\left (13 A -15 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\frac {3 \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d a}-\frac {3 \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d a}\) | \(207\) |
risch | \(\frac {i \left (9 A \,{\mathrm e}^{6 i \left (d x +c \right )}-9 B \,{\mathrm e}^{6 i \left (d x +c \right )}+9 A \,{\mathrm e}^{5 i \left (d x +c \right )}-9 B \,{\mathrm e}^{5 i \left (d x +c \right )}+24 A \,{\mathrm e}^{4 i \left (d x +c \right )}-24 B \,{\mathrm e}^{4 i \left (d x +c \right )}+24 A \,{\mathrm e}^{3 i \left (d x +c \right )}-12 B \,{\mathrm e}^{3 i \left (d x +c \right )}+39 A \,{\mathrm e}^{2 i \left (d x +c \right )}-27 B \,{\mathrm e}^{2 i \left (d x +c \right )}+7 A \,{\mathrm e}^{i \left (d x +c \right )}-3 B \,{\mathrm e}^{i \left (d x +c \right )}+16 A -12 B \right )}{3 d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 d a}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 d a}-\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{2 d a}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 d a}\) | \(276\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 368 vs.
\(2 (125) = 250\).
time = 0.28, size = 368, normalized size = 2.81 \begin {gather*} \frac {A {\left (\frac {2 \, {\left (\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {16 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {15 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}\right )}}{a - \frac {3 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {3 \, a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} - \frac {a \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}}} - \frac {9 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} + \frac {9 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} + \frac {6 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - 3 \, B {\left (\frac {2 \, {\left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {3 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a - \frac {2 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} - \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} + \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} + \frac {2 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.35, size = 168, normalized size = 1.28 \begin {gather*} -\frac {9 \, {\left ({\left (A - B\right )} \cos \left (d x + c\right )^{4} + {\left (A - B\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 9 \, {\left ({\left (A - B\right )} \cos \left (d x + c\right )^{4} + {\left (A - B\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (4 \, {\left (4 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (7 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{2} - {\left (A - 3 \, B\right )} \cos \left (d x + c\right ) + 2 \, A\right )} \sin \left (d x + c\right )}{12 \, {\left (a d \cos \left (d x + c\right )^{4} + a d \cos \left (d x + c\right )^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {A \sec ^{4}{\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.45, size = 182, normalized size = 1.39 \begin {gather*} -\frac {\frac {9 \, {\left (A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {9 \, {\left (A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {6 \, {\left (A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{a} + \frac {2 \, {\left (15 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 16 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 9 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3} a}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.64, size = 152, normalized size = 1.16 \begin {gather*} \frac {\left (5\,A-3\,B\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (4\,B-\frac {16\,A}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (3\,A-B\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )}-\frac {3\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (A-B\right )}{a\,d}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B\right )}{a\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________